<?php
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id' => 'advertising-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => true,
    'clientOptions' => array(
        'validateOnSubmit' => true
    ),
    'type' => 'horizontal',
    'htmlOptions' => array(
        'enctype'=> 'multipart/form-data'
    )
));
?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>

<?php echo $form->textFieldRow($model, 'title', array('class' => 'span5', 'maxlength' => 255)); ?>

<?php echo $form->textAreaRow($model, 'description', array('rows' => 6, 'cols' => 50, 'class' => 'span8')); ?>

<?php echo $form->dropDownListRow($model, 'category_id', CHtml::listData(Category::model()->findAll(array('order'=>'name')), 'category_id', 'name'), array('class' => 'span5')); ?>

<?php echo $form->dropDownListRow($model, 'type_id', CHtml::listData(Type::model()->findAll(array('order'=>'name')), 'type_id', 'name'), array('class' => 'span5')); ?>

<?php echo $form->textFieldRow($model, 'manufacturer', array('class' => 'span5', 'maxlength' => 255)); ?>

<?php echo $form->textFieldRow($model, 'price', array('class' => 'span5', 'hint' => 'Empty this field to set "all reasonable offers considered"')); ?>

<?php if(!$model->isNewRecord) : ?>
<div class="control-group">
    <label class="control-label">Current Image</label>
    <div class="controls">
        <img src="<?php echo $model->getImageUrl() ?>" />
    </div>
</div>
<?php endif; ?>
<?php echo $form->hiddenField($model, 'image'); ?>
<div class="control-group">
    <label class="control-label">Select Image</label>
    <div class="controls">
        <?php echo CHtml::fileField('image') ?>
    </div>
</div>

<?php echo $form->textFieldRow($model, 'author', array('class' => 'span5', 'maxlength' => 60)); ?>

<?php echo $form->textFieldRow($model, 'email', array('class' => 'span5', 'maxlength' => 60)); ?>

<?php echo $form->dropDownListRow($model, 'country', CHtml::listData(Country::model()->findAll(array('order' => 'country_name')), 'country_iso', 'country_name'), array('class' => 'span5', 'maxlength' => 60)); ?>

<?php echo $form->textFieldRow($model, 'state', array('class' => 'span5', 'maxlength' => 60)); ?>

<?php echo $form->textFieldRow($model, 'city', array('class' => 'span5', 'maxlength' => 60)); ?>

<?php echo $form->datePickerRow($model, 'expireDate', array('class' => 'span5')); ?>

<?php echo $form->dropDownListRow($model, 'featured', array(
    0 => 'No',
    1 => 'Yes'
), array('class' => 'span5')); ?>

<?php echo $form->dropDownListRow($model, 'status', Advertising::getStatusArray(), array('class' => 'span5')); ?>

<div class="form-actions">
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'buttonType' => 'submit',
        'type' => 'primary',
        'label' => $model->isNewRecord ? 'Create' : 'Save',
    ));
    ?>
</div>

<?php $this->endWidget(); ?>
